Adds an \ If needed, quit the \ when needed too...
Adds an "\" If needed, quit the "\" when needed too...
Rate Adds an \ If needed, quit the \ when needed too...
(2(2 Vote))
'
'FuncMode.- (0 or 1), if you set 1 comparePath will add an "\", if you set to
'0 ComparePath will remove the "\".
'
'You can put a FileName too.
'EX.
'
'ComparePath "C:\windows\system",1,"Kernel32.dll"
'Result Will Be: C:\windows\system\Kernel32.dll
'
'DO NOT USE A file name With FuncMode= 0
'--------------------------
Function ComparePath(ByVal strPathName As String, ByVal funcMode As Integer, Optional ByVal strFilename As String) As String
Dim aux As Integer
If funcMode = 1 Then
If Right(Trim(strPathName), Len("\")) <> "\" Then
ComparePath = Trim$(RTrim$(strPathName) & "\" & Trim$(strFilename))
Else
ComparePath = Trim$(RTrim$(strPathName) & Trim$(strFilename))
End If
Else
If strFilename <> "" Then
Err.Raise 1, , "Function can't use mode 0 with a file name."
Exit Function
End If
If Right(Trim(strPathName), Len("\")) <> "\" Then
ComparePath = Trim$(RTrim$(strPathName))
Else
aux = Len(strPathName)
ComparePath = Trim$(RTrim$(Left$(strPathName, aux - 1)))
End If
End If
End Function
Adds an \ If needed, quit the \ when needed too... Comments
No comments yet — be the first to post one!
Post a Comment